package cn.qdhlm.collectservice.core.component.analyse;


import cn.qdhlm.collectservice.common.Constant;
import cn.qdhlm.collectservice.service.UtilityService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @Name: AnyAfn00
 * @Description: 确认/否认（AFN=00H）
 * @Author: jiangcs
 */
@Log4j2
@Component
public class AnyAfn00 {
    @Autowired
    private UtilityService utilityService;

    public boolean execute(int fn, int sn, String terminalNo) {
        boolean executeFlag = true;

        // F1：对收到报文中的数据单元标识进行确认
        switch (fn) {
            case 1:
                log.info("execute: fn[{}], sn[{}], terminalNo[{}]", fn, sn, terminalNo);

                // 更新命令结果状态
                Map<String, Object> resultMap = new HashMap<>(1);
                resultMap.put("statusCode", Constant.SYMBOL_00);
//                utilityService.updateCommandResultAndStatus(terminalNo, sn, resultMap, 2);

                break;
            default:
                executeFlag = false;

                log.error("execute: fn[{}] match fail", fn);
        }

        return executeFlag;
    }
}
